<template>
    <el-table-column
        v-if="config.type"
        :type="config.type"
        :prop="config.prop"
        :label="config.label"
        :width="config.width"
        :min-width="config.minWidth"
        :fixed="config.fixed"
        :align="config.align"
        :header-align="config.headerAlign"
        :resizable="config.resizable"
        :show-overflow-tooltip="
            config.showOverflowTooltip === undefined && true
        "
        :class-name="config.className"
        >
    </el-table-column>
    <el-table-column
        v-else
        :prop="config.prop"
        :label="config.label"
        :width="config.width"
        :min-width="config.minWidth"
        :fixed="config.fixed"
        :align="config.align"
        :header-align="config.headerAlign"
        :resizable="config.resizable"
        :show-overflow-tooltip="
            config.showOverflowTooltip === undefined && true
        "
        :class-name="config.className"
        >
        <template slot-scope="colScoped">
            <Render 
                v-if="config.render" 
                :row="colScoped.row"
                :column="colScoped.column"
                :index="colScoped.$index"
                :config="config"
            ></Render>
            <template v-else>{{ colScoped.row[config.prop] }}</template>
        </template>
    </el-table-column>
</template>
<script>
import Render from "./Render"
export default {
    name:"RenderColumn",
    components:{
        Render
    },
    props:{
        // 列配置
        config:{
            type:Object,
            require: true,
            default(){ return null }
        }
    }
}
</script>